package com.entor;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;

@SpringBootApplication
@EnableEurekaClient
public class EurekaServerCustomerRibbonApplication {

    public static void main(String[] args) {
        SpringApplication.run(EurekaServerCustomerRibbonApplication.class, args);
    }
    /**
     * 注入RestTemplate对象到ioc容器，使用负载均衡请求服务
     */
    @Bean
    @LoadBalanced
    public RestTemplate template(){
        return new RestTemplate();
    }
}
